home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / Metafont / Inputs / ec / exrulett.mf < prev    next >
Text File  |  1997-03-16  |  36KB  |  766 lines

  1. % exrulett.mf
  2. %
  3. % (c) Copyright 1995, 1996, 1997 J"org Knappen
  4. % (c) Copyright 1990, 1992 Norbert Schwarz
  5. %
  6. % This file is part of ecfonts version 1.0
  7. %
  8. % Please read the files 00readme.txt, 00inst.txt, 00error.txt, and
  9. % copyrite.txt for further information
  10. %
  11. % You find some documentation in ecdoc.tex (needs LaTeX2e)
  12. %
  13. % Content:
  14. %
  15. %  uppercase letters A to Z
  16.  
  17. version_check(1,0);  % |version_check| was introduced in dc1.3
  18.  
  19. ecchar "The letter A";
  20. beginchar("A",13u#,cap_height#,0);
  21. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  22. numeric left_stem,right_stem,outer_jut,alpha;
  23. right_stem=cap_stem-stem_corr;
  24. left_stem=min(cap_hair if hefty: -3stem_corr fi,right_stem);
  25. outer_jut=.8cap_jut; x1l=w-x4r=l+letter_fit+outer_jut+.5u; y1=y4=0;
  26. x2-x1=x4-x3; x3r=x2r+apex_corr; y2=y3=h+apex_o+apex_oo;
  27. alpha=diag_ratio(2,left_stem,y2-y1,x4r-x1l-apex_corr);
  28. penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
  29. penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
  30. z0=whatever[z1r,z2r]=whatever[z3l,z4l];
  31. if y0<h-cap_notch_cut: y0:=h-cap_notch_cut;
  32.  fill z0+.5right{down}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
  33.   --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  34.   ...{up}z0+.5left--cycle; % left and right diagonals
  35. else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
  36.   --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
  37. penpos5(whatever,angle(z2-z1)); z5=whatever[z1,z2];
  38. penpos6(whatever,angle(z3-z4)); z6=whatever[z3,z4]; y6=y5;
  39. if hefty: y5r else: y5 fi =5/12y0;
  40. y5r-y5l=y6r-y6l=cap_band; penstroke z5e--z6e; % bar line
  41. if serifs: numeric inner_jut; pickup tiny.nib;
  42.  prime_points_inside(1,2); prime_points_inside(4,3);
  43.  if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  44.  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
  45.  dish_serif(1',2,a,1/2,outer_jut,b,.6,inner_jut)(dark);  % left serif
  46.  dish_serif(4',3,c,1/2,inner_jut,d,1/3,outer_jut); fi  % right serif
  47. penlabels(0,1,2,3,4,5,6); endchar;
  48.  
  49. ecchar "The letter B";
  50. beginchar("B",12.5u#,cap_height#,0);
  51. italcorr .75cap_height#*slant-.5u#;
  52. adjust_fit(cap_serif_fit#,0);
  53. numeric left_stem,right_curve,middle_weight;
  54. left_stem=cap_stem-hround 2stem_corr; middle_weight=.6vair+.5;
  55. pickup tiny.nib; pos1(left_stem,0); pos2(left_stem,0);
  56. lft x1l=lft x2l=hround max(2u,3u-.5left_stem); top y1=h; bot y2=0;
  57. filldraw stroke z1e--z2e; % stem
  58. penpos3(cap_band,90); penpos4(cap_band,90);
  59. penpos6(middle_weight,-90); penpos7(middle_weight,-90);
  60. penpos8(middle_weight,90); penpos9(middle_weight,90);
  61. penpos5(right_curve-stem_corr,0); penpos10(right_curve,0);
  62. penpos11(cap_band,-90); penpos12(cap_band,-90);
  63. z3r=top z1; y4=y3; y5=.5[y4,y6]; y6=y7; y7l-y8l=vair;
  64. z12r=bot z2; y11=y12; y10=.5[y11,y9]; y8=y9; .5[y7l,y8l]=.52h;
  65. x4=x6; x9=x11=x4+.5u; x7=x8=x1; x9l:=x4+.25u;
  66. x5r=hround(w-1.5u); x10r=hround(w-u);
  67. if serifs: right_curve=cap_curve-stem_corr; x4=.5[x1,w-1.5u];
  68. else: right_curve=cap_curve-3stem_corr; x4=.5[x1,w-2.5u];
  69.  x4l:=x4l-.5u; x9l:=x9l-.5u; fi
  70. x6l:=x6l-.5u; x11l:=x11l-.5u;
  71. fill stroke z3e..super_arc.e(4,5) & super_arc.e(5,6)..z7e;  % upper lobe
  72. fill stroke z8e..super_arc.e(9,10) & super_arc.e(10,11)..z12e;  % lower lobe
  73. if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  74.  nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
  75. math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;
  76.  
  77. ecchar "The letter C";
  78. if serifs: beginchar("C",13u#,cap_height#,0);
  79.  italcorr cap_height#*slant-.5u#;
  80.  adjust_fit(0,0);
  81.  pickup fine.nib; pos1(cap_hair,0); pos2(cap_band,90);
  82.  pos3(cap_curve,180); pos4(cap_band,270); pos5(hair,360);
  83.  rt x1r=rt x5r=hround(w-u); lft x3r=hround u; x2=x4=.55[x3,x1];
  84.  top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
  85.  bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
  86.  y5=max(good.y .95(h-y1),y4l+eps);
  87.  (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
  88.  (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
  89.  filldraw stroke z1e{x2-x1,10(y2-y1)}
  90.   ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...{up}z5e; % arc
  91.  pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
  92.  x1r-x1'=2cap_curve-fine; y1'=y1;
  93.  path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
  94.  numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
  95.  filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
  96. else: beginchar("C",11.5u#,cap_height#,0);
  97.  italcorr cap_height#*slant-.5u#;
  98.  adjust_fit(0,0);
  99.  pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
  100.  pos3(cap_curve,180); pos4(slab,270); pos5(flare,275);
  101.  rt x1r=hround(w-1.1u); x2=x4=.5w+1.25u;
  102.  lft x3r=hround max(u,2u-.5cap_curve); rt x5r=hround(w-.9u);
  103.  top y1r=vround .95h+o; top y2r=h+o; y3=.5h;
  104.  bot y4r=-o; bot y5r=vround .08h-o; y5l:=good.y y5l; x5l:=good.x x5l;
  105.  filldraw stroke rterm.e(2,1,right,.9,4) & super_arc.e(2,3)
  106.   & super_arc.e(3,4) & term.e(4,5,right,.8,4); fi % arc and terminals
  107. math_fit(-.3cap_height#*slant-.5u#,.5ic#);
  108. penlabels(1,1',2,3,4,5,6); endchar;
  109.  
  110. ecchar "The letter D";
  111. beginchar("D",13.5u#,cap_height#,0);
  112. italcorr .7cap_height#*slant-.5u#;
  113. adjust_fit(cap_serif_fit#,0);
  114. pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
  115. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
  116. filldraw stroke z1e--z2e; % stem
  117. penpos3(cap_band,90); penpos4(cap_band,90);
  118. penpos5(cap_curve-stem_corr,0);
  119. penpos6(cap_band,-90); penpos7(cap_band,-90);
  120. z3r=top z1; y4=y3; y5=.51[y4,y6]; y6=y7;
  121. z7r=bot z2; x4=x6=.5w+.25u; x5r=hround(w-u);
  122. x4l:=x6l:=x4-.25cap_curve;
  123. fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
  124. if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  125.  nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
  126. math_fit(0,ic#-.5u#); penlabels(1,2,3,4,5,6,7); endchar;
  127.  
  128. ecchar "The letter E";
  129. beginchar("E",12u#-width_adj#,cap_height#,0);
  130. italcorr cap_height#*slant-beak_jut#-.5u#;
  131. adjust_fit(cap_serif_fit#,0);
  132. h:=vround(h-stem_corr);
  133. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  134. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
  135. filldraw stroke z1e--z2e; % stem
  136. pickup crisp.nib; pos3(slab,90); pos4(hair,0);
  137. top y3r=h; x3=x1; rt x4r=hround(w-u); y4=good.y(y3l-beak)-eps;
  138. arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
  139. pos5(cap_bar,-90); pos6(hair,0);
  140. top y5l=vround(.52[y2,y1]+.5cap_bar); x5=x1;
  141. pos0(cap_bar,90); pos7(hair,0);
  142. z0=z5; x6=x7; y6-y5l=y0l-y7;
  143. if serifs: rt x6r=hround(w-4.4u+.5hair); y6=good.y(y5l+.6beak)+eps;
  144.  rt x9r=hround(w-.5u);
  145. else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
  146. arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
  147. pos8(slab if not serifs:+2stem_corr fi,-90); pos9(hair,0);
  148. bot y8r=0; x8=x2; y9=good.y(y8l+7/6beak)+eps;
  149. arm(8,9,h,beak_darkness,1.5beak_jut);  % lower arm and beak
  150. if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  151.  nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
  152. math_fit(0,.5ic#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
  153.  
  154. ecchar "The letter F";
  155. beginchar("F",11.5u#-width_adj#,cap_height#,0);
  156. italcorr cap_height#*slant-beak_jut#-.25u#;
  157. adjust_fit(cap_serif_fit#,0);
  158. h:=vround(h-stem_corr);
  159. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  160. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
  161. filldraw stroke z1e--z2e; % stem
  162. pickup crisp.nib; pos3(slab,90); pos4(hair,0);
  163. top y3r=h; x3=x1; rt x4r=hround(w-.75u); y4=good.y(y3l-beak)-eps;
  164. arm(3,4,e,beak_darkness,beak_jut);  % upper arm and beak
  165. pos5(cap_bar,-90); pos6(hair,0);
  166. top y5l=vround(.5[y2,y1]+.5cap_bar); x5=x1;
  167. pos0(cap_bar,90); pos7(hair,0);
  168. z0=z5; x6=x7; y6-y5l=y0l-y7;
  169. if serifs: rt x6r=hround(w-4u+.5hair); y6=good.y(y5l+.6beak)+eps;
  170.  rt x9r=hround(w-.5u);
  171. else: rt x6r=hround(w-1.5u); y6=y5l+eps; rt x9r=hround(w-.75u); fi
  172. arm(5,6,f,beak_darkness,0); arm(0,7,g,beak_darkness,0);  % middle arm and serif
  173. if serifs: nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  174.  dish_serif(2,1,c,1/3,cap_jut,d,1/3,1.25cap_jut); fi  % lower serif
  175. math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7,8,9); endchar;
  176.  
  177. ecchar "The letter G";
  178. if serifs: beginchar("G",14u#,cap_height#,0);
  179.  italcorr cap_height#*slant-1.5u#-.5cap_serif_fit#;
  180.  adjust_fit(0,.5cap_serif_fit#);
  181.  pickup tiny.nib; pos0(cap_stem,0); pos7(cap_stem,0);
  182.  rt x0r=hround(w-2u); y0=good.y(.1[bar_height,x_height]+1); x7=x0;
  183.  pickup fine.nib;
  184.  if hefty: bot y7=0; pos5(cap_stem,0); x5=x0; top y5=tiny.top y0;
  185.  else: pos5(cap_hair,0); pos8(cap_stem,0);
  186.   y7=.5bar_height; z5l=z8l; z8=z7; x9=x8r; bot y9=0;
  187.   filldraw z8l{down}..{4(x9-x8),y9-y8}z9--z8r--cycle; fi % spur
  188.  pos1(cap_hair,0); pos2(cap_band,90);
  189.  pos3(cap_curve,180); pos4(cap_band,270);
  190.  rt x1r=hround(w-2u); lft x3r=hround u; x2=x4=.55[x3,x1];
  191.  top y2r=h+o; bot y4r=-o; y3=.5[y2,y4];
  192.  bot y1=min(vround max(.6h,x_height-.5vair),bot y2l-eps);
  193.  (x2l',y2l)=whatever[z2r,z1l]; x2l:=min(x2l',x2l+.5u);
  194.  (x4l',y4l)=whatever[z4r,z5l]; x4l:=min(x4l',x4l+.5u);
  195.  filldraw stroke z1e{x2-x1,10(y2-y1)}
  196.   ...pulled_arc.e(2,3) & pulled_arc.e(3,4)...z5e{up}; % arc
  197.  pos6(.3[fine.breadth,cap_hair],0); x6r=x1r; top y6=h+o;
  198.  x1r-x1'=2cap_curve-fine; y1'=y1;
  199.  path upper_arc; upper_arc=z1{x2-x1,10(y2-y1)}..z2{left};
  200.  numeric t; t=xpart(upper_arc intersectiontimes (z6l--z1'));
  201.  filldraw z1r--z6r--z6l--subpath(t,0) of upper_arc--cycle; % barb
  202.  pickup tiny.nib; filldraw stroke z0e--z7e;  % stem
  203.  dish_serif(0,7,a,1/3,max(cap_jut,2.25u),b,1/3,1.25u);  % serif
  204.  math_fit(-.3cap_height#*slant-.5u#,ic#);
  205. else: beginchar("G",12u#,cap_height#,0);
  206.  italcorr cap_height#*slant-.5u#;
  207.  adjust_fit(0,0);
  208.  pickup fine.nib; pos1(1.2flare,80); pos2(slab,90);
  209.  pos3(cap_curve,180); pos4(slab,270); pos5(flare,270);
  210.  rt x1r=hround(w-1.35u); x2=x4=.5w+u;
  211.  lft x3r=hround max(u,2u-.5cap_curve); rt x5l=hround(w-1.2u);
  212.  top y1r=vround .93h+o; top y2r=h+o; y3=.5h;
  213.  bot y4r=-o; bot y5r=vround .07h-o;
  214.  filldraw stroke rterm.e(2,1,right,.9,4)&super_arc.e(2,3)
  215.   & super_arc.e(3,4) & term.e(4,5,right,1,4); % arc and terminals
  216.  pos0(stem,0); pos7(stem,0);
  217.  z7r=z5r; x0=x7; top y0=1+vround .35[bar_height,x_height];
  218.  filldraw stroke z0e--z7e;  % stem
  219.  pos8(cap_bar,90); pos9(cap_bar,90);
  220.  z0r=z9r; y8=y9; lft x8=hround x4;
  221.  filldraw stroke z8e--z9e;  % bar
  222.  math_fit(-.3cap_height#*slant-.5u#,.5ic#); fi
  223. penlabels(0,1,1',2,3,4,5,6,7,8,9); endchar;
  224.  
  225. ecchar "The letter H";
  226. beginchar("H",13u#+width_adj#,cap_height#,0);
  227. italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
  228. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  229. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  230. pos3(cap_stem,0); pos4(cap_stem,0);
  231. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); x3=x4=w-x1;
  232. top y1=top y3=h; bot y2=bot y4=0;
  233. filldraw stroke z1e--z2e; % left stem
  234. filldraw stroke z3e--z4e; % right stem
  235. penpos5(cap_bar,90); penpos6(cap_bar,90);
  236. x5=x1; x6=x3; y5=y6=.52h;
  237. fill stroke z5e--z6e;  % bar
  238. if serifs: numeric inner_jut;
  239.  if rt x1r+cap_jut+.5u+1<=lft x3l-cap_jut: inner_jut=cap_jut;
  240.  else: rt x1r+inner_jut+.5u+1=lft x3l-inner_jut; fi
  241.  dish_serif(1,2,a,1/3,cap_jut,b,1/3,inner_jut);  % upper left serif
  242.  dish_serif(2,1,c,1/3,cap_jut,d,1/3,inner_jut); % lower left serif
  243.  dish_serif(3,4,e,1/3,inner_jut,f,1/3,cap_jut);  % upper left serif
  244.  dish_serif(4,3,g,1/3,inner_jut,h,1/3,cap_jut); fi  % lower left serif
  245. math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;
  246.  
  247. ecchar "The letter I";
  248. beginchar("I",max(6u#,4u#+cap_stem#),cap_height#,0);
  249. italcorr cap_height#*slant-.25u#;
  250. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  251. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  252. lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
  253. filldraw stroke z1e--z2e; % stem
  254. if serifs or monospace:
  255.  dish_serif(1,2,a,1/3,1.05cap_jut,b,1/3,1.05cap_jut);  % upper serif
  256.  dish_serif(2,1,c,1/3,1.05cap_jut,d,1/3,1.05cap_jut);  fi % lower serif
  257. if slitex:
  258.  pickup crisp.nib;           % arms based on proportions of uppercase E
  259.  pos3(slab,90); pos4(slab if not serifs:+2stem_corr fi,-90);
  260.  x3=x4=x1; top y3r=h; bot y4r=0;
  261.  pos5(hair,0); pos6(hair,0); % top and bottom right arms
  262.  rt x5r=rt x6r=hround(w-u);
  263.  pos7(hair,180); pos8(hair,180); % top and bottom left arms
  264.  lft x7r=lft x8r=hround(u);
  265.  y5=y7=good.y(y3l-beak)-eps; % beak in case we ever want a beaked serif!
  266.  y6=y8=good.y(y4l+beak)+eps; % watch that this doesn't get too heavy
  267.  arm(3,5,a,darkness,jut); arm(3,7,b,darkness,jut); % top left and right arms
  268.  arm(4,6,c,darkness,jut); arm(4,8,d,darkness,jut); % bottom left and right
  269. fi
  270. math_fit(0,.5ic#); penlabels(1,2 if slitex:,3,4,5,6,7,8 fi); endchar;
  271. font_cap_stem cap_stem#;
  272.  
  273. ecchar "The letter J";
  274. beginchar("J",9u#,cap_height#,0);
  275. italcorr cap_height#*slant-cap_serif_fit#
  276.  +.75cap_jut#-2.5u#+min(.5cap_stem#,u#);
  277. adjust_fit(0,cap_serif_fit#);
  278. pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
  279. top y1=h; rt x1r=hround(w-2u); x2=x1; y2=.21h;
  280. if serifs: pos3(vair,-90); pos4(cap_hair,-180);
  281.  pos5(flare+(cap_stem-stem),-180);
  282.  bot y3r=-o; x3=.5[x4,x2]; y5=1/6h; rt x5l=hround 2.75u; z5r=z4r;
  283.  filldraw stroke z1e--z2e&super_arc.e(2,3);  % stem and arc
  284.  dish_serif(1,2,a,1/3,1.3cap_jut,b,1/3,.75cap_jut);  % serif
  285.  pickup tiny.nib; bulb(3,4,5);  % bulb
  286. else: filldraw stroke z1e--z2e;  % stem
  287.  pickup fine.nib; pos3(cap_stem',0); z3=z2;
  288.  pos4(flare,angle(6.5u,-h)); pos5(1.1flare,-100);
  289.  bot y4r=-o; x4r=.5[x5r,x3r]; lft x5r=hround.75u; bot y5r=vround.06h-o;
  290.  filldraw stroke z3e{down}....term.e(4,5,left,1,4); fi % arc and terminal
  291. math_fit(0,.5ic#-.5u#); penlabels(1,2,3,4,5); endchar;
  292.  
  293. ecchar "The letter K";
  294. beginchar("K",13.5u#,cap_height#,0);
  295. italcorr cap_height#*slant-.5u#;
  296. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  297. numeric right_jut,stem[],alpha[];
  298. if serifs: right_jut=.6cap_jut;
  299. else: right_jut=.4tiny; fi
  300. pickup tiny.nib; pos1(fudged.cap_stem,0); pos2(fudged.cap_stem,0);
  301. lft x1l=lft x2l=hround max(2u,3u-.5fudged.cap_stem); top y1=h; bot y2=0;
  302. filldraw stroke z1e--z2e; % stem
  303. stem2=max(tiny.breadth,fudged.cap_stem-3stem_corr);
  304. stem1=max(tiny.breadth,fudged.hair if hefty:-3stem_corr fi);
  305. top y3=h; rt x3r=hround(r-letter_fit-u-right_jut);
  306. bot y6=0; rt x6r=hround(r-letter_fit-.75u-right_jut);
  307. x4=x1; y4=1/3h;
  308. alpha1=diag_ratio(1,.5(stem1-tiny),y3-y4,x3r-x4);
  309. penpos3(alpha1*(stem1-tiny),0); penpos4(whatever,-90);
  310. alpha2=diag_ratio(1,.5(stem2-tiny),y1-y6,x6r-x1);
  311. penpos6(alpha2*(stem2-tiny),0);
  312. forsuffixes $=l,r: y3'$=h; y6'$=0; z4$=z3'$+whatever*(z3-z4);
  313.  z5$=z6'$+whatever*(z1-z6)=whatever[z3,z4]; endfor
  314. z5=.5[z5l,z5r];
  315. z3'r=z3r+penoffset z3-z4 of currentpen+whatever*(z3-z4);
  316. % we have also |z3'l=z3l+penoffset z4-z3 of currentpen+whatever*(z3-z4)|;\]
  317. z6'r=z6r+penoffset z1-z6 of currentpen+whatever*(z1-z6);
  318. z6'l=z6l+penoffset z6-z1 of currentpen+whatever*(z1-z6);
  319. fill z4r--diag_end(4r,3'r,1,.5,3'l,4l)--z4l--cycle;  % upper diagonal
  320. fill z5l--diag_end(5l,6'l,.5,1,6'r,5r)--z5r--cycle;  % lower diagonal
  321. if serifs: numeric inner_jut;
  322.  if rt x2r+cap_jut+.5u+1<=lft x6l-cap_jut: inner_jut=cap_jut;
  323.  else: rt x2r+cap_jut+.5u+1=lft x6l-inner_jut; fi
  324.  dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut); % upper stem serif
  325.  dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut);  % lower stem serif
  326.  dish_serif(3,4,e,2/3,1.2cap_jut,f,1/2,right_jut)(dark); % upper diagonal serif
  327.  dish_serif(6,5,g,1/2,inner_jut,h,1/3,right_jut)(dark);fi % lower diagonal serif
  328. math_fit(0,.5ic#); penlabels(1,2,3,4,5,6); endchar;
  329.  
  330. ecchar "The letter L";
  331. beginchar("L",11u#-width_adj#,cap_height#,0);
  332. adjust_fit(cap_serif_fit#,0);
  333. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  334. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem); top y1=h; bot y2=0;
  335. filldraw stroke z1e--z2e; % stem
  336. pickup crisp.nib; pos3(slab,-90); pos4(hair,0);
  337. bot y3r=0; x3=x2; y4=y3l+7/6beak+eps; rt x4r=hround(w-.75u);
  338. arm(3,4,e,1.2beak_darkness,beak_jut);  % lower arm and beak
  339. if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,1.25cap_jut);  % upper serif
  340.  nodish_serif(2,1,c,1/3,cap_jut,d,1/3,.5cap_jut); fi  % lower serif
  341. math_fit(0,u#); penlabels(1,2,3,4); endchar;
  342.  
  343. ecchar "The letter M";
  344. beginchar("M",16u#+width_adj#,cap_height#,0);
  345. italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
  346. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  347. numeric stem[]; % thicknesses of the four strokes
  348. stem1=hround(fudged.hair+stem_corr);
  349. stem2=hround(fudged.cap_stem-4stem_corr);
  350. stem3=hround(fudged.hair-stem_corr);
  351. stem4=hround(fudged.cap_stem-3stem_corr);
  352. if stem4<stem1: stem4:=stem1; fi
  353. pickup tiny.nib; pos1(stem1,0); pos2(stem1,0);
  354. pos3(stem4,0); pos4(stem4,0);
  355. x1=x2; x3=x4; x1l=w-x3r; rt x3r=hround min(w-2u,w-3u+.5stem4);
  356. top y1=top y3=h; bot y2=bot y4=0;
  357. filldraw stroke z1e--z2e; % left stem
  358. filldraw stroke z3e--z4e; % right stem
  359. penpos5(stem2,0); penpos6(stem2,0); penpos7(stem3,0); penpos8(stem3,0);
  360. x5l=x1; x6l=x7l; x8=lft x3l; x6-x5=x8-x7; y5=y8=h; y6=y7;
  361. if hefty: y6=if monospace: vround 1/3h else: o fi;
  362.  numeric upper_notch,lower_notch;
  363.  upper_notch=h-cap_notch_cut; lower_notch=y6+cap_notch_cut;
  364.  x1'=rt x1r; z1'=whatever[z5l,z6l]; x3'=lft x3l; z3'=whatever[z7r,z8r];
  365.  z0=whatever[z5r,z6r]=whatever[z7l,z8l];
  366.  fill z5l..
  367.   if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
  368.   {z6-z5}diag_in(5l,6l,1,6r)..diag_out(7l,1,7r,8r){z8-z7}
  369.   if y3'<upper_notch: ...{up}(x3'-1,upper_notch){right} fi
  370.   ..z8r--diag_out(8r,1,8l,7l){z7-z8}
  371.   if y0<=lower_notch: ..{z7-z8}z0{z5-z6}..
  372.   else: ...{down}(x0+.5,lower_notch)--(x0-.5,lower_notch){up}... fi
  373.   {z5-z6}diag_in(6r,5r,1,5l)--cycle;  % diagonals
  374. else: y6=0; z0=whatever[z5r,z6r]=whatever[z7l,z8l];
  375.  fill z5l..{z6-z5}diag_in(5l,6l,1,6r)..diag_out(7l,1,7r,8r){z8-z7}
  376.   ..z8r--diag_out(8r,1,8l,7l){z7-z8}..{z7-z8}z0{z5-z6}
  377.   ..{z5-z6}diag_in(6r,5r,1,5l)--cycle; fi  % diagonals
  378. if serifs: serif(1,2,a,1/3,-cap_jut);  % upper left serif
  379.  dish_serif(2,1,b,1/2,cap_jut,c,1/2,cap_jut)(dark); % lower left serif
  380.  serif(3,4,d,1/3,cap_jut); %  upper right serif
  381.  dish_serif(4,3,e,1/3,cap_jut,f,1/3,cap_jut); fi  % lower right serif
  382. math_fit(0,max(.5ic#-.5u#,0));
  383. penlabels(0,1,1',2,3,3',4,5,6,7,8); endchar;
  384.  
  385. ecchar "The letter N";
  386. beginchar("N",13u#+width_adj#,cap_height#,0);
  387. italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
  388. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  389. numeric thin_stem; thin_stem=hround(fudged.hair+stem_corr);
  390. pickup tiny.nib; pos1(thin_stem,0); pos2(thin_stem,0);
  391. pos3(thin_stem,0); pos4(thin_stem,0);
  392. pickup tiny.nib; top y1=top y3=h; bot y2=bot y4=0;
  393. x1=x2; x3=x4; x1l=w-x3r;
  394. rt x3r=hround min(w-2u,w-3u+.5fudged.cap_stem);
  395. filldraw stroke z1e--z2e; % left stem
  396. filldraw stroke z3e--z4e; % right stem
  397. if hefty: penpos5(fudged.cap_stem,0); penpos6(fudged.cap_stem,0);
  398.  x5l=x1; x6r=x4; y5=h; y6=0;
  399.  numeric upper_notch,lower_notch;
  400.  upper_notch=h-cap_notch_cut; lower_notch=cap_notch_cut;
  401.  x1'=rt x1r; z1'=whatever[z5l,z6l]; x4'=lft x4l; z4'=whatever[z5r,z6r];
  402.  fill z5l..
  403.   if y1'<upper_notch: {right}(x1'+1,upper_notch){down}... fi
  404.   {z6-z5}diag_in(5l,6l,1,6r)--z6r..
  405.   if y4'>lower_notch: {left}(x4'-1,lower_notch){up}... fi
  406.   {z5-z6}diag_in(6r,5r,1,5l)--cycle;  % diagonal
  407. else: penpos5(whatever,0); penpos6(whatever,90);
  408.  z5l=z1l; z6l=z4l;
  409.  z7=z6l+(max(eps,cap_stem-3stem_corr-tiny),0) rotated (angle(z5l-z6l)-90);
  410.  z5r=z7+whatever*(z5l-z6l); z6r=z7+whatever*(z5l-z6l);
  411.  filldraw stroke z5e..z6e; fi  % diagonal
  412. if serifs: if hefty: serif(1,2,a,1/3,-cap_jut); % upper left serif
  413.  else: serif(5,6,a,1/3,-cap_jut); fi  % upper left serif
  414.  dish_serif(2,1,b,1/2,cap_jut,c,1/2,cap_jut)(dark); % lower left serif
  415.  dish_serif(3,4,e,1/2,cap_jut,f,1/2,cap_jut)(dark); fi  % upper right serif
  416. math_fit(0,max(.5ic#-.5u#,0)); penlabels(1,1',2,3,4,4',5,6,7); endchar;
  417.  
  418. ecchar "The letter O";
  419. beginchar("O",14u#-width_adj#,cap_height#,0);
  420. italcorr .7cap_height#*slant-.5u#;
  421. adjust_fit(0,0);
  422. penpos1(vair',90); penpos3(vround(vair+1.5vair_corr),-90);
  423. penpos2(cap_curve,180); penpos4(cap_curve,0);
  424. if monospace: x2r=hround 1.5u;
  425.  interim superness:=sqrt superness;  % make |"O"|, not |"0"|
  426. else: x2r=hround u; fi
  427. x4r=w-x2r; x1=x3=.5w; y1r=h+o; y3r=-o;
  428. y2=y4=.5h-vair_corr; y2l:=y4l:=.52h;
  429. penstroke pulled_super_arc.e(1,2)(.5superpull)
  430.  & pulled_super_arc.e(2,3)(.5superpull)
  431.  & pulled_super_arc.e(3,4)(.5superpull)
  432.  & pulled_super_arc.e(4,1)(.5superpull) & cycle;  % bowl
  433. math_fit(-.3cap_height#*slant-.5u#,ic#-.5u#); penlabels(1,2,3,4); endchar;
  434.  
  435. ecchar "The letter P";
  436. beginchar("P",12u#,cap_height#,0);
  437. italcorr .75cap_height#*slant-.5u#;
  438. adjust_fit(cap_serif_fit#,0);
  439. pickup tiny.nib; penpos1(cap_stem'-tiny,0); penpos2(cap_stem-tiny,0);
  440. pos0(cap_stem',0); pos0'(cap_stem,0);
  441. lft x1l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
  442. x1l=x2l=x0l=x0'l; y0=y0'=y7;
  443. penpos3(cap_band,90); penpos4(cap_band,90);
  444. penpos5(cap_curve if hefty:-3stem_corr fi,0);
  445. penpos6(.5[vair,cap_band],-90); penpos7(.5[vair,cap_band],-90);
  446. z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
  447. x7=x2; y7l=vround .5h; x4=x6=.5w+.75u; x5r=hround(w-u);
  448. x4l:=x6l:=x4-.25cap_curve;
  449. filldraw stroke z1e--z0e--z0'e--z2e; % stem
  450. fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
  451. if serifs: nodish_serif(1,0,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  452.  dish_serif(2,0',c,1/3,cap_jut,d,1/3,cap_jut); fi  % lower serif
  453. math_fit(0,ic#-2.5u#); penlabels(0,1,2,3,4,5,6,7); endchar;
  454.  
  455. ecchar "The letter Q";
  456. beginchar("Q",14u#-width_adj#,cap_height#,comma_depth#);
  457. italcorr .7cap_height#*slant-.5u#;
  458. adjust_fit(0,0);
  459. numeric light_curve; light_curve=cap_curve-hround stem_corr;
  460. penpos1(vair',90); penpos3(vair',-90);
  461. penpos2(light_curve,180); penpos4(light_curve,0);
  462. if monospace: x2r=hround 1.5u;
  463.  interim superness:=sqrt superness;  % make |"Q"| like |"O"|
  464. else: x2r=hround u; fi
  465. x4r=w-x2r; x1=x3=.5w; y1r=h+o; y2=y4=.5h-vair_corr; y3r=-o;
  466. penstroke pulled_super_arc.e(1,2)(.5superpull)
  467.  & pulled_super_arc.e(2,3)(.5superpull)
  468.  & pulled_super_arc.e(3,4)(.5superpull)
  469.  & pulled_super_arc.e(4,1)(.5superpull) & cycle;  % bowl
  470. pickup tiny.nib;
  471. if hefty: penpos5(1.2(.5[cap_bar,light_curve]),0); penpos6(1.2light_curve,0);
  472.  x5=.5w; x6r=hround(w-1.5u);
  473.  y5=vround .28h; y6=-d;
  474.  fill diag_end(6r,5r,.25,1,5l,6l)--diag_end(5l,6l,.5,1,6r,5r)--cycle;  % tail
  475. else: pos3'(vair,270); pos5(vair,180); pos6(vair,90);
  476.  pos7(cap_curve,85); penpos8(eps,180);
  477.  z3'=z3; x6=x3; top y6r=vround(.2h+.5vair);
  478.  lft x5r=hround(.5w-1.25u-.5vair); y5=.5[y3,y6];
  479.  bot y7l=-d; x7l=2/3[x6,x8]; y8=0; rt x8=hround(x4r+.1u);
  480.  filldraw stroke z3'e{left}...z5e{up}...z6e{right}
  481.   ..z7e{right}...z8e{up}; fi % tail
  482. math_fit(-.3cap_height#*slant-.5u#,ic#); penlabels(1,2,3,4,5,6,7,8); 
  483. endchar;
  484.  
  485. ecchar "The letter R";
  486. beginchar("R",if serifs: 12u#+.5max(2u#,cap_curve#)
  487.  else:12.5u#-.5width_adj# fi,cap_height#,0);
  488. italcorr .75cap_height#*slant- if serifs: 1.75 else: .5 fi\\ u#;
  489. adjust_fit(cap_serif_fit#,0);
  490. pickup tiny.nib; pos1(cap_stem',0); pos2(cap_stem',0);
  491. lft x1l=lft x2l=hround max(2u,3u-.5cap_stem'); top y1=h; bot y2=0;
  492. filldraw stroke z1e--z2e; % stem
  493. penpos3(cap_band,90); penpos4(cap_band,90);
  494. penpos5(cap_curve if hefty:-3stem_corr fi,0);
  495. penpos6(vair,-90); penpos7(vair,-90);
  496. z3r=top z1; y4=y3; y5=.5[y4l,y6l]; y6=y7;
  497. x7=x2; y7l=vround(.5h+.5vair); x4=x6;
  498. if serifs: x4=.5w-.5u; x5r=hround(w-2.25u);
  499. else: x4=.5w+.5u; x5r=hround(w-u); fi
  500. x4l:=x6l:=x4-.125cap_curve;
  501. fill stroke z3e..pulled_arc.e(4,5) & pulled_arc.e(5,6)..z7e;  % lobe
  502. if serifs: pos6'(vair,-90); pos0(cap_stem,180);
  503.  pos8(cap_curve,180); pos9(vair,-90); pos10(hair,0);
  504.  z6'=z6; lft x0r=lft x8r=hround(x5-2/3u-.5cap_curve);
  505.  y8=1/3[y2,y7]; y0=3/5[y2,y7]; x9=.5[x8l,x10r];
  506.  bot y9r=-o; rt x10r=hround(w-.05u); y10=1/4[y2,y7];
  507.  filldraw stroke z6'e{right}..z0e---z8e....z9e{right}..z10e{up};  % tail
  508.  nodish_serif(1,2,a,1/3,cap_jut,b,1/3,.5cap_jut);  % upper serif
  509.  dish_serif(2,1,c,1/3,cap_jut,d,1/3,cap_jut);  % lower serif
  510. else: penpos8(cap_stem-2stem_corr,0); penpos9(cap_stem,0);
  511.  x8=x6+.5u; y8=y6; x9r=hround(w-.5u); y9=0;
  512.  fill z8l--diag_end(8l,9l,.5,1,9r,8r)--z8r--cycle; fi  % tail
  513. math_fit(0,.75ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;
  514.  
  515. ecchar "The letter S";
  516. beginchar("S",10u#,cap_height#,0);
  517. italcorr cap_height#*slant-u#;
  518. adjust_fit(0,0);
  519. numeric theta; theta=90-angle(50u,h); slope:=-h/50u;  % angle at middle
  520. numeric s_slab; s_slab=if serifs:slab else:vround .2[slab,cap_stem] fi;
  521. numeric ess'; ess'=max(fine.breadth,cap_ess);
  522. pickup fine.nib; pos2(max(fine.breadth,s_slab-vround vair_corr),-90);
  523. pos0(ess',theta); pos7(s_slab,-90);
  524. x2+x7=2x0=w; x7-x2=if serifs: u else: 0 fi; top y2l=h+o; bot y7r=-o;
  525. y0=.52h; lft x3l=hround u; rt x6r=hround(w-u);
  526. x3r-x3l=x6r-x6l=hround .5[s_slab,ess']-fine;
  527. ellipse_set(2l,3l,4l,0l); ellipse_set(2r,3r,4r,0r); y3=y3r;
  528. ellipse_set(7l,6l,5l,0l); ellipse_set(7r,6r,5r,0r); y6=y6r;
  529. filldraw stroke super_arc.e(2,3) & z3e{down}
  530.  ..z4e---z5e..z6e{down} & super_arc.e(6,7);  % main stroke
  531. if serifs: pos1(hair,180); pos8(hair,180);
  532.  rt x1l=hround(w-1.5u); lft x8r=hround u;
  533.  bot y1=vround 2/3h+1; top y8=vround 1/3h-1;
  534.  filldraw stroke z1e{x2-x1,10(y2-y1)}....{left}z2e;  % upper arc
  535.  filldraw stroke z7e{left}....{up}z8e;  % lower arc
  536.  path upper_arc, lower_arc;
  537.  upper_arc=z1{x2-x1,10(y2-y1)}....{left}z2;
  538.  lower_arc=z7{left}....{up}z8;
  539.  pos10(.3[fine.breadth,cap_hair],0); pos9(.3[fine.breadth,cap_hair],0);
  540.  x10r=x1l; top y10=top y2l; x9l=x8r; bot y9=bot y7r;
  541.  x1l-x1'=x8'-x8r=1.6cap_curve-fine; y1'=y1; y8'=y8;
  542.  numeric t; t=xpart(upper_arc intersectiontimes(z10l--z1'));
  543.  filldraw z1l--z10r--z10l--subpath(t,0) of upper_arc--cycle;  % upper barb
  544.  t:=xpart(lower_arc intersectiontimes(z9r--z8'));
  545.  filldraw z8r--z9l--z9r--subpath(t,1) of lower_arc--cycle;  % lower barb
  546. else: pos1(1.2flare,-100); pos8(1.2flare,-100);
  547.  x1l=good.x(x1l+w-1.75u-rt x1); lft x8r=hround .8u;
  548.  top y1l=vround .93h+o; bot y8r=vround .1h-o;
  549.  filldraw stroke term.e(2,1,right,.9,4);  % upper arc and terminal
  550.  filldraw stroke term.e(7,8,left,1,4); fi  % lower arc and terminal
  551. math_fit(0,.5ic#); penlabels(0,1,1',2,3,4,5,6,7,8,8',9,10); endchar;
  552.  
  553. ecchar "The letter T";
  554. beginchar("T",13u#-width_adj#,cap_height#,0);
  555. italcorr cap_height#*slant-beak_jut#-.25u#;
  556. adjust_fit(0,0);
  557. h:=vround(h-2stem_corr);
  558. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  559. lft x1l=lft x2l=hround(.5w-.5cap_stem); top y1=h; bot y2=0;
  560. filldraw stroke z1e--z2e; % stem
  561. pickup crisp.nib; pos3(slab,90); pos4(hair,0);
  562. top y3r=h; x3=x1; rt x4r=hround(w-.65u); y4=good.y(y3l-beak)-eps;
  563. arm(3,4,e,beak_darkness,.7beak_jut);  % right arm and beak
  564. pos5(hair,180); x5=w-x4; y5=y4;
  565. arm(3,5,f,beak_darkness,-.7beak_jut);  % left arm and beak
  566. if serifs: dish_serif(2,1,c,1/3,1.414cap_jut,d,1/3,1.414cap_jut);  % lower serif
  567.  nodish_serif(1,2,a,1/3,.5cap_jut,b,1/3,.5cap_jut); fi  % upper bracketing
  568. math_fit(-.75cap_height#*slant,ic#-2.5u#); penlabels(1,2,3,4,5,6); endchar;
  569.  
  570. ecchar "The letter U";
  571. beginchar("U",13u#+.5width_adj#,cap_height#,0);
  572. italcorr cap_height#*slant-cap_serif_fit#+cap_jut#-2.5u#+min(.5cap_stem#,u#);
  573. if monospace: adjust_fit(cap_serif_fit#-.5u#,cap_serif_fit#-.5u#)
  574. else: adjust_fit(cap_serif_fit#,cap_serif_fit#) fi;
  575. pickup tiny.nib; pos1(cap_stem,0); pos2(cap_stem,0);
  576. pos2'(cap_stem,180); z2'=z2;
  577. pos3(cap_band,-90);
  578. pos4(cap_hair,0); pos5(cap_hair,0);
  579. x1=x2; x3=.5[x1,x5]; x4=x5; x1l=w-x5r;
  580. top y1=top y5=h; y2=y4=1/3h; bot y3r=-o;
  581. lft x1l=hround max(2u,3u-.5cap_stem);
  582. filldraw stroke z1e--z2e; % left stem
  583. filldraw stroke pulled_arc.e(2',3)
  584.  & pulled_arc.e(3,4)&z4e--z5e; % arc and right stem
  585. if serifs: dish_serif(1,2,a,1/3,cap_jut,b,1/3,cap_jut); % left serif
  586.  dish_serif(5,4,c,1/2,cap_jut,d,1/2,cap_jut)(dark); fi  % right serif
  587. math_fit(-cap_serif_fit#-.3cap_height#*slant-min(cap_height#*slant,u#),
  588.  max(.5ic#-.5u#,0)); penlabels(1,2,3,4,5); endchar;
  589.  
  590. ecchar "The letter V";
  591. beginchar("V",13u#,cap_height#,0);
  592. italcorr cap_height#*slant+.25u#;
  593. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  594. numeric left_stem,right_stem,outer_jut,alpha;
  595. left_stem=cap_stem-stem_corr;
  596. right_stem=min(cap_hair if hefty:-2stem_corr fi,left_stem);
  597. outer_jut=.75cap_jut; x1l=w-x4r=l+letter_fit+outer_jut+.25u; y1=y4=h;
  598. x2-x1=x4-x3; x2l+apex_corr=x3l; y2=y3=-apex_o;
  599. alpha=diag_ratio(2,right_stem,y1-y2,x4r-x1l-apex_corr);
  600. penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
  601. penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
  602. z0=whatever[z1r,z2r]=whatever[z3l,z4l];
  603. if y0>cap_notch_cut: y0:=cap_notch_cut;
  604.   fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)
  605.     --diag_end(4r,3r,1,1,2l,1l)--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  606.     ...{down}z0+.5left--cycle; % left and right diagonals
  607. else: fill z0--diag_end(0,4l,1,1,4r,3r)--diag_end(4r,3r,1,1,2l,1l)
  608.     --diag_end(2l,1l,1,1,1r,0)--cycle; fi % left and right diagonals
  609. if serifs: numeric inner_jut; pickup tiny.nib;
  610.  prime_points_inside(1,2); prime_points_inside(4,3);
  611.  if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  612.  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
  613.  dish_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut);  % left serif
  614.  dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark); fi  % right serif
  615. math_fit(.75u#-cap_height#*slant,ic#-4u#); penlabels(0,1,2,3,4); endchar;
  616.  
  617. ecchar "The letter W";
  618. beginchar("W",18u#,cap_height#,0);
  619. italcorr cap_height#*slant+.25u#;
  620. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  621. numeric stem[],outer_jut,upper_notch,alpha,mid_corr;
  622. outer_jut=.7cap_jut; x1l=w-x8r=l+letter_fit+outer_jut+.25u;
  623. stem1=fudged.cap_stem-stem_corr;
  624. stem4=min(fudged.hair if hefty:-2stem_corr fi,stem1);
  625. stem2=stem4 if hefty:-2stem_corr fi;
  626. stem3=stem1 if hefty:-2stem_corr fi;
  627. x2-x1=x4-x3=x6-x5=x8-x7; x2l+apex_corr=x3l; x6l+apex_corr=x7l;
  628. y1=y8=h; y2=y3=y6=y7=-apex_o; y4=y5=if monospace: vround .6 fi\\ h;
  629. mid_corr=if monospace or hefty:-apex_corr else: 1/3jut fi;
  630. alpha=diag_ratio(4,stem2-stem3+stem4,y1-y2,x8r-x1l+mid_corr-2apex_corr);
  631. penpos1(alpha*stem1,0); penpos2(alpha*stem1,0);
  632. penpos3(alpha*stem2,0); penpos4(alpha*stem2,0);
  633. penpos5(alpha*stem3,0); penpos6(alpha*stem3,0);
  634. penpos7(alpha*stem4,0); penpos8(alpha*stem4,0);
  635. x4l-x1l=floor(x4l-x1l+.5(x5r+mid_corr-x4r)); % |x5r+mid_corr| $\approx$ |x4r|
  636. z23=whatever[z1r,z2r]=whatever[z3l,z4l];
  637. z45=whatever[z3r,z4r]=whatever[z5l,z6l];
  638. z67=whatever[z5r,z6r]=whatever[z7l,z8l]; upper_notch=y4-cap_notch_cut;
  639. fill diag_end(1l,2l,1,1,3r,4r){z4-z3}
  640.  ...if y45<upper_notch:(x45,upper_notch)+.5left{up}
  641.    --(x45,upper_notch)+.5right{down} else: z45&z45 fi
  642.  ...{z6-z5}diag_end(5l,6l,1,1,7r,8r)--diag_end(7r,8r,1,1,8l,7l){z7-z8}
  643.  ...if y67>cap_notch_cut:(x67,cap_notch_cut)+.5right{down}
  644.    --(x67,cap_notch_cut)+.5left{up} else: z67&z67 fi
  645.  ...{z5-z6}special_diag_end(6,5,4,3){z3-z4}
  646.  ...if y23>cap_notch_cut:(x23,cap_notch_cut)+.5right{down}
  647.    --(x23,cap_notch_cut)+.5left{up} else: z23&z23 fi
  648.  ...{z1-z2}diag_end(2r,1r,1,1,1l,2l)--cycle;  % diagonals
  649. if serifs: numeric inner_jut[]; pickup tiny.nib;
  650.  prime_points_inside(1,2); prime_points_inside(5,6); prime_points_inside(8,7);
  651.  if monospace: inner_jut1=inner_jut4=1.5cap_jut;
  652.  elseif hefty: inner_jut1=inner_jut4=cap_jut;
  653.  else: fill diag_end(6r,5r,1,1,5l,6l)--.9[z5l,z6l]
  654.    ..{z5-z6}.1[z5r,z6r]--cycle; % middle stem
  655.   inner_jut2=.7inner_jut1; inner_jut4=1.1inner_jut3;
  656.   if rt x1'r+cap_jut+.5u+1<=lft x5'l-.7cap_jut: inner_jut1=cap_jut;
  657.   else: rt x1'r+inner_jut1+.5u+1=lft x5'l-inner_jut2; fi
  658.   if rt x5'r+cap_jut+.5u+1<=lft x8'l-1.1cap_jut: inner_jut3=cap_jut;
  659.   else: rt x5'r+inner_jut3+.5u+1=lft x8'l-inner_jut4; fi
  660.   dish_serif(5',6,e,1/3,inner_jut2,f,1/2,inner_jut3); fi  % middle serif
  661.  dish_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut1);  % left serif
  662.  dish_serif(8',7,c,.6,inner_jut4,d,1/2,outer_jut)(dark); fi  % right serif
  663. math_fit(.75u#-cap_height#*slant,ic#-2.5u#);
  664. penlabels(0,1,2,3,4,5,6,7,8,23,45,67); endchar;
  665.  
  666. ecchar "The letter X";
  667. beginchar("X",13u#,cap_height#,0);
  668. italcorr cap_height#*slant-.25u#;
  669. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  670. numeric stem[],outer_jut,xjut,alpha[];
  671. stem1=cap_stem-2stem_corr; stem2=min(cap_hair,stem1);
  672. outer_jut=.75cap_jut; xjut= if serifs: (stem1-stem2)/4 else: 0 fi;
  673. x1l=l+letter_fit+.5u+outer_jut; x2r=r-letter_fit-u-outer_jut-xjut;
  674. x3l=l+letter_fit+.25u+outer_jut+xjut; x4r=r-letter_fit-.25u-outer_jut;
  675. y1=y2=h; y3=y4=0;
  676. alpha1=diag_ratio(1,stem1,h,x4r-x1l);
  677. alpha2=diag_ratio(1,stem2,h,x2r-x3l);
  678. penpos1(alpha1*stem1,0); penpos2(alpha2*stem2,0);
  679. penpos3(alpha2*stem2,0); penpos4(alpha1*stem1,0);
  680. if hefty: z0=whatever[z1,z4]=whatever[z2,z3];
  681.  x12=x34=x0; y13=y24=y0;
  682.  z12=whatever[z2l,z3l]; z13=whatever[z2l,z3l];
  683.  z24=whatever[z2r,z3r]; z34=whatever[z2r,z3r];
  684.  forsuffixes $=13,24,34: z$'=.1[z$,z0]; endfor
  685.  fill diag_end(12,1r,.5,1,1l,13')--z13'--diag_end(13',3l,1,.5,3r,34')--z34'
  686.   --diag_end(34',4l,.5,1,4r,24')--z24'
  687.   --diag_end(24',2r,1,.5,2l,12)--z12--cycle; % diagonals
  688. else: fill diag_end(4r,1r,.5,1,1l,4l)
  689.   --diag_end(1l,4l,.5,1,4r,1r)--cycle; % left diagonal
  690.  fill diag_end(2l,3l,.5,1,3r,2r)
  691.   --diag_end(3r,2r,.5,1,2l,3l)--cycle; fi  % right diagonal
  692. if serifs: numeric inner_jut[]; pickup tiny.nib;
  693.  prime_points_inside(1,4); prime_points_inside(2,3);
  694.  prime_points_inside(3,2); prime_points_inside(4,1);
  695.  if rt x1'r+cap_jut+.5u+1<=lft x2'l-cap_jut-xjut: inner_jut1=cap_jut;
  696.  else: rt x1'r+inner_jut1+.5u+1=lft x2'l-inner_jut1-xjut; fi
  697.  if rt x3'r+cap_jut+.5u+1<=lft x4'l-cap_jut-xjut: inner_jut2=cap_jut;
  698.  else: rt x3'r+inner_jut2+.5u+1=lft x4'l-inner_jut2-xjut; fi
  699.  dish_serif(1',4,a,1/3,outer_jut,b,2/3,inner_jut1);  % upper left serif
  700.  dish_serif(4',1,c,2/3,inner_jut2,d,1/3,outer_jut);  % lower right serif
  701.  dish_serif(2',3,e,2/3,inner_jut1+xjut,
  702.   f,1/2,outer_jut+xjut)(dark);  % upper right serif
  703.  dish_serif(3',2,g,1/2,outer_jut+xjut,
  704.   h,2/3,inner_jut2+xjut)(dark); fi  % lower left serif
  705. math_fit(0,.5ic#); penlabels(0,1,2,3,4,12,13,24,34); endchar;
  706.  
  707. ecchar "The letter Y";
  708. beginchar("Y",13u#,cap_height#,0);
  709. italcorr cap_height#*slant+.45u#;
  710. adjust_fit(cap_serif_fit#,cap_serif_fit#);
  711. numeric left_stem,right_stem,outer_jut,dy,alpha;
  712. left_stem=cap_stem-stem_corr;
  713. right_stem=min(cap_hair if hefty:-2stem_corr fi,left_stem);
  714. outer_jut=.75cap_jut; x1l=w-x4r=l+letter_fit+outer_jut+.05u;
  715. x2l=x5l=hround(.5w-.5left_stem); x3r=x5r; y1=y4=h; y2=y3=y5=.4h;
  716. dy=y1-y2; alpha=((x2l-x1l)++dy)/dy;
  717. penpos1(alpha*left_stem,0); penpos2(alpha*left_stem,0);
  718. penpos3(alpha*right_stem,0); penpos4(alpha*right_stem,0);
  719. penpos5(left_stem,0); penpos6(left_stem,0); x5=x6; y6=0;
  720. z0=whatever[z1r,z2r]=whatever[z3l,z4l];
  721. if y0>y2+cap_notch_cut: y0:=y2+cap_notch_cut;
  722.   fill z0+.5right{up}...{z4-z3}diag_end(3l,4l,1,1,4r,3r)--z5r
  723.     --diag_end(5r,6r,1,1,6l,5l)--z5l--diag_end(2l,1l,1,1,1r,2r){z2-z1}
  724.     ...{down}z0+.5left--cycle; % diagonals and stem
  725. else: fill z0--diag_end(0,4l,1,1,4r,3r)--z5r
  726.     --diag_end(5r,6r,1,1,6l,5l)--z5l
  727.     --diag_end(2l,1l,1,1,1r,0)--cycle; fi  % diagonals and stem
  728. if serifs: numeric inner_jut; pickup tiny.nib;
  729.  prime_points_inside(1,2); prime_points_inside(4,3); prime_points_inside(6,5);
  730.  if rt x1'r+cap_jut+.5u+1<=lft x4'l-cap_jut: inner_jut=cap_jut;
  731.  else: rt x1'r+inner_jut+.5u+1=lft x4'l-inner_jut; fi
  732.  dish_serif(1',2,a,1/3,outer_jut,b,1/2,inner_jut);  % upper left serif
  733.  dish_serif(4',3,c,.6,inner_jut,d,1/2,outer_jut)(dark);  % upper right serif
  734.  dish_serif(6',5,e,1/3,cap_jut,f,1/3,cap_jut); fi  % lower serif
  735. math_fit(.5u#-cap_height#*slant,ic#-4u#);
  736. penlabels(0,1,2,3,4,5,6); endchar;
  737.  
  738. ecchar "The letter Z";
  739. beginchar("Z",11u#,cap_height#,0);
  740. italcorr cap_height#*slant-.5u#;
  741. adjust_fit(0,0);
  742. numeric arm_thickness[],z_stem;
  743. if hefty: arm_thickness1=Vround(slab-vair_corr); arm_thickness2=slab;
  744.  z_stem=.8[vair,cap_stem];
  745. else: arm_thickness1=slab; arm_thickness2=vround(slab+vair_corr);
  746.  z_stem=.9[vair,cap_stem]; fi
  747. pickup tiny.nib; x3l=x4l=w-x1r=w-x2r; lft x3l=hround u;
  748. top y1=h; y2=min(y1,h-2/3arm_thickness1);
  749. bot y4=0; y3=max(y4,2/3arm_thickness2);
  750. numeric alpha; alpha=diag_ratio(1,z_stem-tiny,y2-y3,x2r-x3l);
  751. penpos1(alpha*(z_stem-tiny),0); penpos2(alpha*(z_stem-tiny),0);
  752. penpos3(alpha*(z_stem-tiny),0); penpos4(alpha*(z_stem-tiny),0);
  753. pair delta; delta=penoffset z3-z2 of currentpen;
  754. fill top lft z1l--z2l+delta---z3l+delta..lft z3l---lft z4l..bot z4l
  755.  ---bot rt z4r--z3r-delta---z2r-delta..rt z2r---rt z1r..top z1r
  756.  ---cycle;  % diagonal
  757. pickup crisp.nib; pos5(arm_thickness1,90); pos6(hair,180);
  758. top y5r=h; x5=x1; lft x6r=hround 1.25u; y6=good.y(y5l-beak)-eps;
  759. arm(5,6,a,beak_darkness**.8,-.4beak_jut);  % upper arm and beak
  760. pos7(arm_thickness2,-90); pos8(hair,0);
  761. bot y7r=0; x7=x4; rt x8r=hround(w-.9u); y8=good.y(y7l+1.2beak)+eps;
  762. arm(7,8,b,beak_darkness**.9,.6beak_jut);  % lower arm and beak
  763. math_fit(0,.5ic#); penlabels(1,2,3,4,5,6,7,8); endchar;
  764.  
  765. endinput;
  766.